package cn.tedu.day01.jnsdlfaq.student.service.impl;

import cn.tedu.day01.jnsdlfaq.student.mapper.StudentMapper;
import cn.tedu.day01.jnsdlfaq.student.pojo.Student;
import cn.tedu.day01.jnsdlfaq.student.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public int insertStudent(Student stu) {
        return studentMapper.insert(stu);
    }

    @Override
    public List<Student> selectAllStudent() {
        return studentMapper.selectList(null);
    }

    @Override
    public int deleteStuById(String id) {
        return studentMapper.deleteById(id);
    }

    @Override
    public int updateStudent(Student stu) {
        return studentMapper.updateById(stu);
    }

    @Override
    public Student selectStuById(String id) {
        return studentMapper.selectById(id);
    }
}
